<script>
    import Vue from 'vue'
    export default {
        onLaunch: function () {
            var t = this
            const updateManager = uni.getUpdateManager();
            updateManager.onCheckForUpdate(function (res) {
                console.log(res);
                // 请求完新版本信息的回调
                if (res.hasUpdate) {
                    updateManager.onUpdateReady(function (res2) {
                        console.log(res2);
                        uni.showModal({
                            title: '更新提示',
                            content: '发现新版本，是否重启应用?',
                            cancelColor: '#eeeeee',
                            confirmColor: '#FF0000',
                            success(res2) {
                                if (res2.confirm) {
                                    // 新的版本已经下载好，调用 applyUpdate 应用新版本并重启
                                    updateManager.applyUpdate();
                                }
                            }
                        });
                    });
                }
            });

            updateManager.onUpdateFailed(function (res) {
                // 新的版本下载失败
                uni.showModal({
                    title: '提示',
                    content: '检查到有新版本，但下载失败，请检查网络设置',
                    success(res) {
                        if (res.confirm) {
                            updateManager.applyUpdate();
                        }
                    }
                });
            });

            t.$api.req_common('sysConfig/list', { condition: 'STAFF_MIS' }, '', false).then(res => {
                if (res.code == 0) {
                    let swtich = false
                    if (res.data[0].value == '0') {
                        swtich = false
                    } else {
                        swtich = true
                    }
                    t.$cfg.switch(swtich)
                }
            })
            uni.getSystemInfo({
                success: function (e) {
                    console.log(e.platform);

                    // #ifdef MP-WEIXIN
                    t.$cfg.platform('mpwx');
                    Vue.prototype.StatusBar = e.statusBarHeight;
                    let custom = wx.getMenuButtonBoundingClientRect();
                    Vue.prototype.Custom = custom;
                    Vue.prototype.CustomBar = custom.bottom + custom.top - e.statusBarHeight;
                    // #endif		
                }
            })
            Vue.prototype.ColorList = [
            ]
        },

        onShow() {
            let t = this;
            uni.getSystemInfo({
                success(res) {
                    t.$cfg.h = Number(res.windowHeight);
                    t.$cfg.w = Number(res.windowWidth);
                }
            });
        },
        methods: {

        }
    }
</script>

<style lang="scss">
    /*每个页面公共css */
    @import "colorui/main.css";
    @import './style/index.scss';
    @import './style/uni.scss';
    @import "colorui/icon.css";
    @import "uview-ui/index.scss";

    /*每个页面公共css */
    page {
        width: 100%;
        height: 100%;
        --mainColor: #435257;
        --borderColor: #c8c7cc;
        --activeColor: #36648B;
    }

    .uni-mask {
        /* z-index: 9999999 !important; */
    }

    .cuIcon {
    }

    view,
    scroll-view,
    swiper,
    swiper-item,
    cover-view,
    cover-image,
    icon,
    text,
    rich-text,
    progress,
    button,
    checkbox,
    form,
    input,
    label,
    radio,
    slider,
    switch,
    textarea,
    navigator,
    audio,
    camera,
    image,
    video {
        box-sizing: border-box;
    }

    /* 骨架屏替代方案 */
    .Skeleton {
        background: #f3f3f3;
        padding: 20upx 0;
        border-radius: 8upx;
    }

    /* 图片载入替代方案 */
    .image-wrapper {
        font-size: 0;
        background: #f3f3f3;
        border-radius: 4px;

        image {
            width: 100%;
            height: 100%;
            transition: .6s;
            opacity: 0;

            &.loaded {
                opacity: 1;
            }
        }
    }

    .clamp {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        display: block;
    }

    .common-hover {
        background: #f5f5f5;
    }

    /*边框*/
    .b-b:after,
    .b-t:after {
        position: absolute;
        z-index: 3;
        left: 0;
        right: 0;
        height: 0;
        content: '';
        transform: scaleY(.5);
        border-bottom: 1px solid #dedede;
    }

    .b-b:after {
        bottom: 0;
    }

    .b-t:after {
        top: 0;
    }

    /* button样式改写 */
    uni-button,
    button {
        height: 80upx;
        line-height: 80upx;
        font-weight: normal;

        &.no-border:before,
        &.no-border:after {
            border: 0;
        }
    }

    uni-button[type=default],
    button[type=default] {
    }

    /* input 样式 */
    .input-placeholder {
        color: #999999;
    }

    .placeholder {
        color: #999999;
    }

    .border-all {
        position: relative;
    }

    .border-all:after {
        position: absolute;
        top: 0;
        left: 0;
        -webkit-box-sizing: border-box;
        box-sizing: border-box;
        width: 200%;
        height: 200%;
        border: 1px solid #E5EAF0;
        border-radius: inherit;
        content: " ";
        -webkit-transform: scale(.5);
        -ms-transform: scale(.5);
        transform: scale(.5);
        -webkit-transform-origin: 0 0;
        -ms-transform-origin: 0 0;
        transform-origin: 0 0;
        pointer-events: none;
        border-radius: 50%;
    }

    .border-bootom {
        position: relative;
    }

    .border-bootom:after {
        position: absolute;
        top: 0;
        left: 0;
        -webkit-box-sizing: border-box;
        box-sizing: border-box;
        width: 200%;
        height: 200%;
        border-bottom: 1px solid #E5EAF0;
        border-radius: inherit;
        content: " ";
        -webkit-transform: scale(.5);
        -ms-transform: scale(.5);
        transform: scale(.5);
        -webkit-transform-origin: 0 0;
        -ms-transform-origin: 0 0;
        transform-origin: 0 0;
        pointer-events: none;
    }

    .border-top {
        position: relative;
    }

    .border-top:after {
        position: absolute;
        top: 0;
        left: 0;
        -webkit-box-sizing: border-box;
        box-sizing: border-box;
        width: 200%;
        height: 200%;
        border-top: 1px solid #E5EAF0;
        border-radius: inherit;
        content: " ";
        -webkit-transform: scale(.5);
        -ms-transform: scale(.5);
        transform: scale(.5);
        -webkit-transform-origin: 0 0;
        -ms-transform-origin: 0 0;
        transform-origin: 0 0;
        pointer-events: none;
    }

    .border-info {
        position: relative;
    }

    .border-info:after {
        position: absolute;
        top: 0;
        left: 0;
        -webkit-box-sizing: border-box;
        box-sizing: border-box;
        width: 200%;
        height: 200%;
        border-radius: 20rpx;
        border-top-left-radius: 0;
        border-top-right-radius: 0;
        border: 1px solid #E5EAF0;
        border-top: 0;
        content: " ";
        -webkit-transform: scale(.5);
        -ms-transform: scale(.5);
        transform: scale(.5);
        -webkit-transform-origin: 0 0;
        -ms-transform-origin: 0 0;
        transform-origin: 0 0;
        pointer-events: none;
    }
</style>